//TODO: may be needs to add edit movie function
MovieEditor = null;

_MovieEditor = function() {
	this.Name = null;
	this.Description = null;
	this.Rating = null;
	this.RatingIMDB = null;
	this.RatingMPAA = null;
	this.Cover = null;
	this.ProfitInRussia = null;
	this.ProfitInUSA = null;
	this.ProfitInEurope = null;
	this.ProfitInOtherCountries = null;
	this.ProfitFromTV = null;
	this.ProfitFromDVD = null;
	this.GenresString = null;
	this.ActorsString = null;
}
_MovieEditor.prototype = {
	AddOne : function() {
		if (ValidationController.CreateAndAddValidationItemToStack(
				$("#NewMovieName").val(), isNullOrEmpty)
				.ValidateAndCleanStack().Result) {
			var nItem = NotificationManager.CreateNotification(
					"Name is empty. Please enter Name", [ "error" ]);
			NotificationManager.ShowMessages([ nItem ]);
			return;
		} else {
			this.Name = $("#NewMovieName").val();
		}

		this.GenresString = $('#NewMovieGenres').val();
		this.ActorsString = $('#NewMovieActors').val();
		this.Description = $("#NewMovieDescription").val();
		this.Rating = $("#NewMovieRating").val();
		this.RatingIMDB = $("#NewMovieRatingIMDB").val();
		this.RatingMPAA = $(":radio[name=NewMovieRatingMPAA]").filter(
				":checked").val();
		this.Cover = $("#NewMovieCover").val();
		this.ProfitInRussia = $('#NewMovieProfitInRussia').val();
		this.ProfitInUSA = $('#NewMovieProfitInUSA').val();
		this.ProfitInEurope = $('#NewMovieProfitInEurope').val();
		this.ProfitInOtherCountries = $('#NewMovieProfitInOtherCountries')
				.val();
		this.ProfitFromTV = $('#NewMovieProfitFromTV').val();
		this.ProfitFromDVD = $('#NewMovieProfitFromDVD').val();

		var _AddMovie = ClientCommandsManager.Get("AddMovie");
		_AddMovie.Name = this.Name;
		_AddMovie.GenresString = this.GenresString;
		_AddMovie.ActorsString = this.ActorsString;
		_AddMovie.MovieDescription = this.Description;
		_AddMovie.Rating = this.Rating;
		_AddMovie.RatingIMDB = this.RatingIMDB;
		_AddMovie.RatingMPAA = this.RatingMPAA;
		_AddMovie.Cover = this.Cover;
		_AddMovie.ProfitInRussia = this.ProfitInRussia;
		_AddMovie.ProfitInUSA = this.ProfitInUSA;
		_AddMovie.ProfitInEurope = this.ProfitInEurope;
		_AddMovie.ProfitInOtherCountries = this.ProfitInOtherCountries;
		_AddMovie.ProfitFromTV = this.ProfitFromTV;
		_AddMovie.ProfitFromDVD = this.ProfitFromDVD;
		ClientCommandsManager.Execute(_AddMovie, this.SuccessHandler, null);
	},
	SuccessHandler : function(data, status, request) {
		if (data) {
			var nItem = NotificationManager.CreateNotification(
					"Movie has been added", [ "ok" ], 10000);
			NotificationManager.ShowMessages([ nItem ]);
		}
	}
}